package com.yaoq.strategy.improve;

/**
 * @ClassName Duck
 * @Description TODO
 * @Author yaoqiang
 * @Date 2020/9/4 15:32
 * @Version 1.0
 */
public abstract class Duck {
    //属性 ，策略接口
    FlyBehavior flyBehavior;

    QuickBehavior quickBehavior;

    public Duck() {
    }

    public void quack() {
        System.out.println("鸭子嘎嘎叫");
    }

    public void swim() {
        System.out.println("鸭子会游泳");
    }

    public void fly() {
        if (flyBehavior != null) {
            flyBehavior.fly();
        }
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuickBehavior(QuickBehavior quickBehavior) {
        this.quickBehavior = quickBehavior;
    }
}
